/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  TouchableOpacity,
  TabBarIOS
} from 'react-native';

const flatList = require("./ios_views/flatList.js");
const activityIndicator = require("./ios_views/activityIndicator.js");
const datePicker = require("./ios_views/common/datePickerIOS.js");
const MyDatePicker = datePicker.date;
const Picker = require("./ios_views/common/pickerIOS.js");
const HeaderBar = require("./ios_views/common/headerBar.js");
const icon = require("./ios_views/config/config.js").icon;
const bookIcon = icon.book;
const movieIcon = icon.movie;

export default class react_native_demo extends Component {
  constructor(props) {
    super(props);
    this.state = {
      selectedTab: "book"
    }
  }
  render() {
    return (
      <TabBarIOS>
        <TabBarIOS.Item
          title="图书"
          selected={this.state.selectedTab === 'book'}
          icon={{uri: bookIcon, scale: 3}}
          onPress={()=>{
            this.setState({selectedTab: "book"})
          }}
        >
          <View style={{flex:1, backgroundColor:"cyan"}}></View>
        </TabBarIOS.Item>
        <TabBarIOS.Item
          title="电影"
          selected={this.state.selectedTab === 'movie'}
          icon={{url: movieIcon, scale: 3}}
          onPress={()=>{
            this.setState({selectedTab: "movie"})
          }}
        >
          <View style={{flex:1, backgroundColor:"yellow"}}></View>
        </TabBarIOS.Item>
      </TabBarIOS>
    );
  }
};
const styles = StyleSheet.create({

});

AppRegistry.registerComponent('react_native_demo', () => react_native_demo);
